<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>主要人员</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body>
        <form id="cust_cst_corp_team_form">
            <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
                <div class="fieldBox col_50">
                    <div class="label">成员类型</div>
                    <div class="field">
                        <span id="mTypCdNm" name="mTypCdNm"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">姓名</div>
                    <div class="field">
                         <span id="mNm" name="rlNm"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">性别</div>
                    <div class="field">
                         <span id="genderCdNm" name="genderCdNm"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">出生日期</div>
                    <div class="field">
                         <span id="birthday" name="birthday"></span>
                    </div>
                </div>                          
                <div class="fieldBox col_50">
                    <div class="label">手机号1</div>
                    <div class="field">
                        <span id="mp1" name="mp1"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">手机号2</div>
                    <div class="field">
                        <span id="mp2" name="mp2"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">办公电话</div>
                    <div class="field">
                        <span id="officeTel" name="officeTel"></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
			        <div class="label">证件类型</div>
			          <div class="field">
			             <span id="certTypCdNm" name="certTypCdNm"></span>
			         </div>
			       </div>
                <div class="fieldBox col_50">
                    <div class="label">证件号</div>
                    <div class="field">
                         <span id="certNo" name="certNo"></span>
                    </div>
                </div>
                <div class="fieldBox col_100">
                    <div class="label">常住地址</div>
                    <div class="field">
                         <span id="homeAddr" name="homeAddr"></span>
                    </div>
                </div>
                <div class="fieldBox col_100">
                    <div class="label">备注</div>
                    <div class="field">
                         <span id="teamRem" name="teamRem"></span>
                    </div>
                </div>
                
                <div class="fieldBox col_100">
                    <div class="sqPanel">
                        <div class="sqPanel_body">
                            <div id="ligergrid_resume" class="sq-grid"></div>
                        </div>
                    </div>
                </div>
                <!-- hide data -->
		        <div class="fieldBox col_100" style="display:none;">
		          <div class="field">
		              <input name="ctId" id="ctId" type="text" class="ui-textbox" value="${ctId}">
		          </div>
		        </div>
            </div>
        </form>
	<script>
		$(function() {
		   $("#cust_cst_corp_team_form").ligerForm({
                validate: true
           });
	       initData();
	       resumeGrid();
		});
		
		frameElement.dialog.onCancel = function () {
			frameElement.dialog.close();
		}
		
		function initData(){
			var ctId = $("#ctId").val();
	    	if(!ctId)return;
	    	var wait_dialog= $.ligerDialog.SQalert({
	            content: LogUtils.LOG_CMM_LOADING,
	            SQ_type: "waitting",
	            onClose: function () {
	            }
	        });
	    	var _url = '<%=path%>/customer/cstcorpteam/getById.do?isEncrypt=1';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{id:ctId},
	    		url: _url,
	    		success:function(msg){
	    			wait_dialog.close();
	    			 if(msg.success == 1){
	    				 setData(msg.data);//设置数据
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
    	}
		
		//设置页面数据
	    function setData(data){
	    	$("#mTypCdNm").html(data.mTypCdNm);
	    	$("#mNm").html(data.mnm);
	    	$("#mp1").html(data.mp1);
	    	$("#mp2").html(data.mp2);
	    	$("#officeTel").html(data.officeTel);
	    	$("#certTypCd").html(data.certTypCd);
	    	$("#certNo").html(data.certNo);
	    	$("#certTypCdNm").html(data.certTypCdNm);
	    	$("#certNo").html(data.certNo);
	    	$("#teamRem").html(data.teamRem);
	    	$("#homeAddr").html(data.homeAddr);
	    	if(data.birthday){
	    		var date = new Date(data.birthday);
	    		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	    		$("#birthday").html(dateStr);
	    	}
	    	$("#genderCdNm").html(data.genderCdNm);
		};
		
			//初始化数据
		 	var resumeGrid;
			function resumeGrid(){
				 var ctId = $("#ctId").val();
				$("#ligergrid_resume").ligerGrid({
		            url: '<%=path%>/customer/cstcorpteamresume/initList.do?memId='+ctId,
		            method: 'get',
		            columns: [
		                {
		                	display: '开始时间', name: 'startDt', type: 'date', format: 'yyyy-MM-dd', 
		                	width: 100, render:renderDate
		                },{
		                    display: '结束时间', name: 'endDt', type: 'date', format: 'yyyy-MM-dd', 
		                    width: 100, render:renderDate
		                },
		                {
		                	display: '工作单位', name: 'workPlc',type: 'text' 
		                },
		                {
		                	display: '职务', name: 'post',type: 'text'
		                }
		            ],
		            onBeforeEdit: function (e) {
		                //e.column.editor.data=typList;
		            },
		            onBeforeSubmitEdit: function (e) {
		                //e.record[e.column.textField] = e.text
		            },
		            onCheckRow: function (checked,data,rowid,rowdata) {
		                //console.log(data);
		            },
		            usePager: false,
		            pageSize: 15,
		            root: 'rows',
		            record: 'total',
		            hideLoadButton: true,
		            width: '98%',
		            height: 300,
		            heightDiff: -2,
		            enabledEdit: true,
		            isScroll: false,
		            checkbox: false,
		            rownumbers: true,
		            allowUnSelectRow: true,
		            alternatingRow: false
		        });

		       resumeGrid = liger.get("ligergrid_resume");
			}
			
			//格式化时间
			function renderDate(rowdata, index, value){
				var dateStr = "";
				if(null != value){
					var date = new Date(value);
					dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
				}
				return dateStr;
			}
	</script>
</body>
</html>